home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / circuits / irsim-ca.2 / irsim-ca / irsim-cap-9.2 / src / ana11 / zoom.c < prev   
C/C++ Source or Header  |  1993-01-15  |  2KB  |  60 lines

  1. /*
  2.  *     ********************************************************************* 
  3.  *     * Copyright (C) 1988, 1990 Stanford University.                     * 
  4.  *     * Permission to use, copy, modify, and distribute this              * 
  5.  *     * software and its documentation for any purpose and without        * 
  6.  *     * fee is hereby granted, provided that the above copyright          * 
  7.  *     * notice appear in all copies.  Stanford University                 * 
  8.  *     * makes no representations about the suitability of this            * 
  9.  *     * software for any purpose.  It is provided "as is" without         * 
  10.  *     * express or implied warranty.  Export of this software outside     * 
  11.  *     * of the United States of America may require an export license.    * 
  12.  *     *********************************************************************
  13.  */
  14.  
  15. #include "ana.h"
  16. #include "ana_glob.h"
  17.  
  18.  
  19. public void Zoom( what )
  20.   char  *what;
  21.   {
  22.     TimeType  start;
  23.     int       steps;
  24.  
  25.     switch( *what )
  26.       {
  27.     case 'i' :                /* zoom in */
  28.         steps = tims.steps / 2;
  29.         if( steps < 10 )
  30.         steps = 10;
  31.         start = tims.start + steps / 2;
  32.         if( start > tims.last )
  33.           {
  34.         start = tims.last - steps / 2;
  35.         if( start < tims.first )
  36.             start = tims.first;
  37.           }
  38.         break;
  39.  
  40.     case 'o' :                /* zoom out */
  41.         steps = tims.steps * 2;
  42.         start = tims.start - tims.steps / 2;
  43.         if( start < tims.first )
  44.         start = tims.first;
  45.         if( steps > max_time or (start + steps) > max_time )
  46.         return;
  47.         break;
  48.       }
  49.  
  50.     if( tims.steps != steps )
  51.       {
  52.     tims.start = start;
  53.     tims.steps = steps;
  54.     tims.end = start + steps;
  55.     RedrawTimes();
  56.     UpdateScrollBar();
  57.      DrawTraces( start, tims.end );
  58.      }
  59.   }
  60.